import React, { Component } from 'react'
import './index.css'

export default class InputAuto extends Component {
  
  handChange = (e) => {
    // console.log(e)
    const textarea = e.target
    // 高度设置为 auto
    textarea.style.height = 'auto'
    textarea.style.height = textarea.scrollHeight + 'px'
  }
  render() {
    return (
      <textarea onInput={this.handChange} className='input-content' rows='1'></textarea>
    )
  }
}
